<?php
include("../includes/common.php");
$title='系统管理';
include './head.php';
if($islogin==1){}else loginmsg('请登录后再操作！');
$mod=isset($_GET['mod'])?$_GET["mod"]:NULL;
if($mod=="site"){
?>

<form method="post" class="layui-form" id="formAdvForm" lay-filter="formAdvForm" role="form">
    
    <div class="layui-fluid" style="padding-bottom: 75px;">
        <div class="layui-card">
            <div class="layui-card-header">网站信息配置</div>
            <div class="layui-card-body">

                <div class="layui-form-item layui-row">
                    <div class="layui-inline layui-col-md6">
                        <label class="layui-form-label">网站LOGO</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input" id="logourl" name="logoimg" value="<?=$conf['logoimg']?>" placeholder="填写logo图片URL，没有请留空" style="padding-right: 80px;" disabled="">
                            <button type="button" class="layui-btn layui-btn-warm" title="查看图片" style="position: absolute;top: 0;right: 0px; cursor: pointer;"><i class="layui-icon layui-icon-picture"></i></button>
                            <button id="upload-logo" type="button" class="layui-btn layui-btn-success upload-logo" title="上传图片" style="position: absolute;top: 0;right: 57px;cursor: pointer;"><i class="layui-icon layui-icon-upload"></i></button>
                        </div>
                    </div>

                    <div class="layui-inline layui-col-md6">
                        <label class="layui-form-label">ICO站标</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input" id="icourl" name="icoimg" value="<?=$conf['icoimg']?>" placeholder="填写站标图片URL，没有请留空" style="padding-right: 80px;" disabled="">
                            <button type="button" class="layui-btn layui-btn-warm" title="查看图片" style="position: absolute;top: 0;right: 0px; cursor: pointer;"><i class="layui-icon layui-icon-picture"></i></button>
                            <button id="upload-ico" type="button" class="layui-btn layui-btn-success upload-ico" title="上传图片" style="position: absolute;top: 0;right: 57px;cursor: pointer;"><i class="layui-icon layui-icon-upload"></i></button>
                        </div>
                    </div>
                    
                    <div class="layui-inline layui-col-md4">
                        <label class="layui-form-label">网站标题</label>
                        <div class="layui-input-block">
                            <input type="text" name="title" class="layui-input" placeholder="网站主要标题" value="<?=$conf['title']?>">
                        </div>
                    </div>

                    <div class="layui-inline layui-col-md4">
                        <label class="layui-form-label">网站名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="name" class="layui-input" placeholder="网站主要标题" value="<?=$conf['name']?>">
                        </div>
                    </div>

                    <div class="layui-inline layui-col-md4">
                        <label class="layui-form-label">禁止访问IP</label>
                        <div class="layui-input-block">
                            <input type="text" name="blackip" class="layui-input" placeholder="多个IP用|隔开" value="<?=$conf['blackip']?>">
                        </div>
                    </div>


                    <div class="layui-inline layui-col-md4">
                        <label class="layui-form-label">备案信息</label>
                        <div class="layui-input-block">
                            <input type="text" name="icp" class="layui-input" value="<?=$conf['icp']?>">
                        </div>
                    </div>

                    <div class="layui-inline layui-col-md12">
                    <label class="layui-form-label">文件搜索功能</label>
                    <div class="layui-input-block">
                        <select name="filesearch" class="layui-input" default="<?=$conf['filesearch']?>" lay-filter="filesearch">
                            <option <?php echo $conf['filesearch'] == 0 ? 'selected ' : '' ?>value="0">关闭</option>
                            <option <?php echo $conf['filesearch'] == 1 ? 'selected ' : '' ?>value="1">开启</option>
                        </select>
                    </div>
                </div>
                </div>
                
                <div class="layui-form-item layui-row">
                    <div class="layui-inline layui-col-md12">
                        <label class="layui-form-label">QQ群链接</label>
                        <div class="layui-input-block">
                            <input class="layui-input" type="text" name="qun" placeholder="售后QQ群链接" value="<?=$conf['qun']?>">
                        </div>
                    </div>
                </div>

                <div class="layui-form-item layui-row">
                    <div class="layui-inline layui-col-md12">
                        <label class="layui-form-label">站点关键词</label>
                        <div class="layui-input-block">
                            <input class="layui-hide" type="text" id="demoTagsInput1" name="keywords" placeholder="请输入网站关键词" value="<?=$conf['keywords']?>">
                        </div>
                    </div>
                </div>

                <div class="layui-form-item layui-row">
                    <div class="layui-inline layui-col-md12">
                        <label class="layui-form-label">网站描述</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea" name="description" placeholder="网站信息描述" rows="5"><?php echo htmlspecialchars($conf['description']); ?></textarea>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item layui-row">
                    <div class="layui-inline layui-col-md12">
                        <label class="layui-form-label">首页公告</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea" name="gonggao" placeholder="不填写则不显示首页公告" rows="5"><?php echo htmlspecialchars($conf['gonggao']); ?></textarea>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-row">
                    <div class="layui-inline layui-col-md12">
                        <label class="layui-form-label">文件查看页公告</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea" name="gg_file" placeholder="不填写则不显示文件公告" rows="5"><?php echo htmlspecialchars($conf['gg_file']); ?></textarea>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-row">
                    <div class="layui-inline layui-col-md12">
                        <label class="layui-form-label">统计代码</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea" name="tongji" placeholder="不填写则不显示统计代码" rows="5"><?php echo htmlspecialchars($conf['tongji']); ?></textarea>
                        </div>
                    </div>
                </div>
               

                

                <div class="layui-form-item layui-row">
                    <div class="layui-inline layui-col-md12">
                        <label class="layui-form-label">首页链接</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea" name="link" placeholder="前面名称|后面链接，多个换行即可" rows="5"><?php echo htmlspecialchars($conf['link']); ?></textarea>
                        </div>
                    </div>
                </div>

            </div>
        </div>

        <div class="form-group-bottom text-right">
            <button type="reset" id="formreset" class="layui-btn layui-btn-primary">&emsp;重置&emsp;</button>
            <button class="layui-btn" type="button" lay-submit lay-filter="notice-btn">&emsp;提交&emsp;</button>
        </div>
    </div>
</form>

<?php
}elseif($mod=='template'){
$title='模板配置';
$mblist=Template::getList();

?>
<form method="post" class="layui-form" id="formAdvForm" lay-filter="formAdvForm" role="form">
    <div class="layui-fluid">
        <div class="layui-card">
                <div class="layui-card-header">模板配置</div>
                <div class="layui-card-body">
                    <div style="white-space:nowrap;overflow-x: auto;">
                    <table class="layui-table">
                        <thead>
                          <tr>
                              <th>模板图片</th>
                              <th>模板名称</th>
                              <th>模板作者</th>
                              <th>适用版本</th>
                              <th>模板介绍</th>
                              <th>模板操作</th>
                          </tr>
                      </thead>
                      <tbody>
                    <?php foreach($mblist as $template){?>
                    <tr>
                        <td><img src="/template/<?php echo $template?>/image.png" onerror="this.src='/assets/images/NoImg.png'" width="120" height="60"></td>
                            <?php  $config = include TEMPLATE_ROOT.("$template/config.php"); ?>
                        <td><?php echo $template?></td>
                        <td><?php echo $config['zuozhe']?></td>
                        <td><?php echo $config['version']?></td>
                        <td><?php echo $config['jieshao']?></td>
                        <?php if($conf['template'] != $template){ ?>
                        <td><a href="javascript:changeTemplate('<?php echo $template?>')" class="layui-btn layui-btn-sm">点击更换</a></td>
                        <?php }else{ ?>
                        <td><a class="layui-btn layui-btn-sm layui-btn-disabled">使用中</a></td>
                        <?php } ?>
                    </tr>
                    <?php }?>
                      </tbody>
                    </table>
            </div>
        </div>
    </div>
</div>
</form>


<?php }elseif($mod=="iptype"){ ?>

<form method="post" class="layui-form" id="formAdvForm" lay-filter="formAdvForm" role="form">
    
    <div class="layui-fluid" style="padding-bottom: 75px;">
        <div class="layui-card">
            <div class="layui-card-header">用户IP地址获取设置</div>
            <div class="layui-card-body">
                
                <div class="layui-form-item">
                    <label class="layui-form-label">IP地址获取方式</label>
                    <div class="layui-input-block">
                        <select name="ip_type" class="layui-input">
                            <option <?php echo $conf['ip_type'] == 0 ? 'selected ' : '' ?>value="0">0_X_FORWARDED_FOR</option>
                            <option <?php echo $conf['ip_type'] == 1 ? 'selected ' : '' ?>value="1">1_X_REAL_IP</option>
                            <option <?php echo $conf['ip_type'] == 2 ? 'selected ' : '' ?>value="2">2_REMOTE_ADDR</option>
                        </select>
                    </div>
                </div>
                
                <div class="layui-form-item">
                    <div class="layui-input-block">
                    <button class="layui-btn layui-btn-fluid" type="button" lay-submit lay-filter="notice-btn">&emsp;提交&emsp;</button>
                    </div>
                </div>
                <hr/>
                <fieldset class="layui-elem-field">
                    <legend>关于IP地址获取</legend>
                    <div class="layui-field-box">
此功能设置用于防止用户伪造IP请求。<br/>
X_FORWARDED_FOR：之前的获取真实IP方式，极易被伪造IP<br/>
X_REAL_IP：在网站使用CDN的情况下选择此项，在不使用CDN的情况下也会被伪造<br/>
REMOTE_ADDR：直接获取真实请求IP，无法被伪造，但可能获取到的是CDN节点IP<br/>
<b>你可以从中选择一个能显示你真实地址的IP，优先选下方的选项。</b>
                    </div>
                </fieldset>
                
            </div>
        </div>
    </div>
</form>

<?php }elseif($mod=="file"){ ?>

<form method="post" class="layui-form" id="formAdvForm" lay-filter="formAdvForm" role="form">
    
    <div class="layui-fluid" style="padding-bottom: 75px;">
        <div class="layui-card">
            <div class="layui-card-header">文件上传设置</div>
            <div class="layui-card-body">
                
                    <div class="layui-form-item">
                        <label class="layui-form-label">图片文件类型</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea" name="type_image" placeholder="多个文件类型用|隔开" rows="1"><?php echo htmlspecialchars($conf['type_image']); ?></textarea>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">音频文件类型</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea" name="type_audio" placeholder="多个文件类型用|隔开" rows="1"><?php echo htmlspecialchars($conf['type_audio']); ?></textarea>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">视频文件类型</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea" name="type_video" placeholder="多个文件类型用|隔开" rows="1"><?php echo htmlspecialchars($conf['type_video']); ?></textarea>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">禁止上传的文件类型</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea" name="type_block" placeholder="多个文件类型用|隔开" rows="1"><?php echo htmlspecialchars($conf['type_block']); ?></textarea>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">文件名屏蔽关键词</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea" name="name_block" placeholder="多个关键词用|隔开" rows="1"><?php echo htmlspecialchars($conf['name_block']); ?></textarea>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">每IP每天限制上传数量</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea" name="upload_limit" placeholder="0或留空为不限制" rows="1"><?php echo htmlspecialchars($conf['upload_limit']); ?></textarea>    
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">上传大小限制</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea" name="upload_size" placeholder="不填写则不限制大小" rows="1"><?php echo htmlspecialchars($conf['upload_size']); ?></textarea>    
                        </div>
                    </div>

                    <div class="layui-form-item">
                    <label class="layui-form-label">视频文件需要审核</label>
                    <div class="layui-input-block">
                        <select name="videoreview" class="layui-input">
                            <option <?php echo $conf['videoreview'] == 0 ? 'selected ' : '' ?>value="0">否</option>
                            <option <?php echo $conf['videoreview'] == 1 ? 'selected ' : '' ?>value="1">是</option>
                        </select>
                    </div>

                    <div class="layui-form-item">
                    <label class="layui-form-label">仅限登录用户上传</label>
                    <div class="layui-input-block">
                        <select name="forcelogin" class="layui-input">
                            <option <?php echo $conf['forcelogin'] == 0 ? 'selected ' : '' ?>value="0">否</option>
                            <option <?php echo $conf['forcelogin'] == 1 ? 'selected ' : '' ?>value="1">是</option>
                        </select>
                    </div>
                </div>
                
                <div class="layui-form-item">
                    <div class="layui-input-block">
                    <button class="layui-btn layui-btn-fluid" type="button" lay-submit lay-filter="notice-btn">&emsp;提交&emsp;</button>
                    </div>
                </div>
                
            </div>
        </div>
    </div>
</form>
<?php }elseif($mod=="cloud"){ ?>

    <form method="post" class="layui-form" id="formAdvForm" lay-filter="formAdvForm" role="form">
    
    <div class="layui-fluid" style="padding-bottom: 75px;">
        <div class="layui-card">
            <div class="layui-card-header">云端账号配置</div>
            <div class="layui-card-body">
                
                    <div class="layui-form-item">
                        <label class="layui-form-label">云端账号</label>
                        <div class="layui-input-block">
                            <input type="text" name="cloud_account" class="layui-input" placeholder="请输入云端账号" value="<?php echo $conf['cloud_account']; ?>">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">云端密码</label>
                        <div class="layui-input-block">
                            <input type="text" name="cloud_password" class="layui-input" placeholder="请输入云端密码" value="<?php echo $conf['cloud_password']; ?>">
                        </div>
                    </div>
                    
                <div class="layui-form-item">
                    <div class="layui-input-block">
                    <button class="layui-btn layui-btn-fluid" type="button" lay-submit lay-filter="notice-btn">&emsp;提交&emsp;</button>
                    </div>
                </div>

                <legend>关于云端</legend>
                    <div class="layui-field-box" style="background: #f8fafc; border-radius: 10px; padding: 18px 20px 12px 20px;">
                        <div style="display: flex; align-items: center; margin-bottom: 14px;">
                            <i class="layui-icon" style="font-size: 20px; color: #1890ff; margin-right: 8px;">&#xe770;</i>
                            <span style="font-size: 15px; color: #333; font-weight: 500;">云端用户账号已配置</span>
                            <button class="layui-btn layui-btn-xs layui-btn-warm" style="margin-left: 18px; border-radius: 16px;" lay-filter="cloud_lt" lay-submit>
                                <i class="layui-icon">&#xe605;</i> 测试连通性
                            </button>
                        </div>
                        <div style="display: flex; align-items: center;">
                            <i class="layui-icon" style="font-size: 20px; color: #ff4d4f; margin-right: 8px;">&#xe65e;</i>
                            <span style="font-size: 15px; color: #333; font-weight: 500;">账户余额查询</span>
                            <button class="layui-btn layui-btn-xs layui-btn-warm" style="margin-left: 18px; border-radius: 16px;" lay-filter="cloud_yue" lay-submit>
                                <i class="layui-icon">&#xe65e;</i> 查询余额
                            </button>
                        </div>
                        云端注册地址：<a href="https://cloud.dnsjxz.cn" target="_blank">https://cloud.dnsjxz.cn</a>  
                    </div>
                
            </div>
        </div>
    </div>
</form>


<?php }elseif($mod=='green'){ 
    
$green_label_porn = explode(',', $conf['green_label_porn']);
	$green_label_terrorism = explode(',', $conf['green_label_terrorism']);
    
?>

<div class="layui-fluid">
    <div class="layui-card">
        <div id="divLoading">
            <div class="layui-card-header">图片检测设置</div>
            <div class="layui-card-body">
                <form method="post" class="layui-form" id="formAdvForm" lay-filter="formAdvForm" role="form">

                    <div class="layui-form-item">
                        <label class="layui-form-label">图片违规检测</label>
                        <div class="layui-input-block">
                            <select class="layui-input" name="green_check" default="<?php echo $conf['green_check'];?>">
                                <option <?php echo $conf['green_check'] == 0 ? 'selected ' : '' ?>value="0">关闭</option>
                                <option <?php echo $conf['green_check'] == 1 ? 'selected ' : '' ?>value="1">阿里云内容安全接口</option>
                                <option <?php echo $conf['green_check'] == 2 ? 'selected ' : '' ?>value="2">腾讯云内容安全接口</option>
                            </select>
                        </div>
                    </div>

                    <div class="layui-form-item text-right">
                        <button type="reset" id="formreset1" class="layui-btn layui-btn-primary">&emsp;重置&emsp;</button>
                        <button class="layui-btn" type="button" lay-submit lay-filter="notice-btn">&emsp;提交&emsp;</button>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <!--阿里云检测-->
    <?php if ($conf['green_check'] == 1) { ?>
    <div class="layui-card">
        <div id="divLoading">
            <div class="layui-card-header">支付宝官方支付接口配置 <a href="https://b.alipay.com/signing/productSetV2.htm" target="_blank" class="layui-btn layui-btn-xs pull-right" style="margin-top: 10px;" type="button">申请地址</a> <a href="https://openhome.alipay.com/dev/workspace/key-manage" target="_blank" class="layui-btn layui-btn-xs pull-right" style="margin-top: 10px; margin-right: 10px;" type="button">密钥查看</a> </div>
            <div class="layui-card-body">
                <form method="post" class="layui-form" id="formAdvForm" lay-filter="formAdvForm" role="form">

                    <div class="layui-form-item">
                        <label class="layui-form-label">阿里云AccessKey Id</label>
                        <div class="layui-input-block">
                            <input type="text" name="aliyun_ak" class="layui-input" value="<?php echo $conf['aliyun_ak'];?>">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">阿里云AccessKey Secret</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea" name="aliyun_sk" placeholder="" rows="5"><?php echo htmlspecialchars($conf['aliyun_sk']); ?></textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">图片检测接入区域</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea" name="green_check_region" placeholder="" rows="5"><?php echo htmlspecialchars($conf['green_check_region']); ?></textarea>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">图片智能鉴黄</label>
                        <div class="layui-input-block">
                            <select class="layui-input" name="green_check_porn" default="<?php echo $conf['green_check_porn'];?>" lay-filter="green_check_porn">
                                <option <?php echo $conf['green_check_porn'] == 0 ? 'selected ' : '' ?>value="0">关闭</option>
                                <option <?php echo $conf['green_check_porn'] == 1 ? 'selected ' : '' ?>value="1">开启</option>
                            </select>
                        </div>
                    </div>

                    <div class="layui-form-item" id="green_check_porn_" style="<?php echo $conf['green_check_porn']!=1?'display:none;':null; ?>">
    <label class="layui-form-label">图片智能鉴黄屏蔽类型</label>
    <div class="layui-input-block">
        <label class="layui-form-checkbox">
            <input type="checkbox" name="green_label_porn[]" value="porn" <?php echo in_array('porn',$green_label_porn)?'checked':null;?>> 色情图片（porn）
        </label>
        <label class="layui-form-checkbox" style="margin-left: 12px;">
            <input type="checkbox" name="green_label_porn[]" value="sexy" <?php echo in_array('sexy',$green_label_porn)?'checked':null;?>> 性感图片（sexy）
        </label>
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">图片暴恐涉政识别</label>
    <div class="layui-input-block">
        <select class="layui-input" name="green_check_terrorism" default="<?php echo $conf['green_check_terrorism'];?>" lay-filter="green_check_terrorism">
            <option <?php echo $conf['green_check_terrorism'] == 0 ? 'selected ' : '' ?>value="0">关闭</option>
            <option <?php echo $conf['green_check_terrorism'] == 1 ? 'selected ' : '' ?>value="1">开启</option>
        </select>
    </div>
</div>
<div class="layui-form-item" id="green_check_terrorism_" style="<?php echo $conf['green_check_terrorism']!=1?'display:none;':null; ?>">
    <label class="layui-form-label">暴恐涉政屏蔽类型</label>
    <div class="layui-input-block">
        <label class="layui-form-checkbox"><input type="checkbox" name="green_label_terrorism[]" value="bloody" <?php echo in_array('bloody',$green_label_terrorism)?'checked':null;?>> 血腥（bloody）</label>
        <label class="layui-form-checkbox" style="margin-left: 12px;"><input type="checkbox" name="green_label_terrorism[]" value="explosion" <?php echo in_array('explosion',$green_label_terrorism)?'checked':null;?>> 爆炸烟光（explosion）</label>
        <label class="layui-form-checkbox" style="margin-left: 12px;"><input type="checkbox" name="green_label_terrorism[]" value="outfit" <?php echo in_array('outfit',$green_label_terrorism)?'checked':null;?>> 特殊装束（outfit）</label>
        <label class="layui-form-checkbox" style="margin-left: 12px;"><input type="checkbox" name="green_label_terrorism[]" value="logo" <?php echo in_array('logo',$green_label_terrorism)?'checked':null;?>> 特殊标识（logo）</label>
        <label class="layui-form-checkbox" style="margin-left: 12px;"><input type="checkbox" name="green_label_terrorism[]" value="weapon" <?php echo in_array('weapon',$green_label_terrorism)?'checked':null;?>> 武器（weapon）</label>
        <label class="layui-form-checkbox" style="margin-left: 12px;"><input type="checkbox" name="green_label_terrorism[]" value="politics" <?php echo in_array('politics',$green_label_terrorism)?'checked':null;?>> 涉政（politics）</label>
        <label class="layui-form-checkbox" style="margin-left: 12px;"><input type="checkbox" name="green_label_terrorism[]" value="violence" <?php echo in_array('violence',$green_label_terrorism)?'checked':null;?>> 打斗（violence）</label>
        <label class="layui-form-checkbox" style="margin-left: 12px;"><input type="checkbox" name="green_label_terrorism[]" value="crowd" <?php echo in_array('crowd',$green_label_terrorism)?'checked':null;?>> 聚众（crowd）</label>
        <label class="layui-form-checkbox" style="margin-left: 12px;"><input type="checkbox" name="green_label_terrorism[]" value="parade" <?php echo in_array('parade',$green_label_terrorism)?'checked':null;?>> 游行（parade）</label>
        <label class="layui-form-checkbox" style="margin-left: 12px;"><input type="checkbox" name="green_label_terrorism[]" value="carcrash" <?php echo in_array('carcrash',$green_label_terrorism)?'checked':null;?>> 车祸现场（carcrash）</label>
        <label class="layui-form-checkbox" style="margin-left: 12px;"><input type="checkbox" name="green_label_terrorism[]" value="flag" <?php echo in_array('flag',$green_label_terrorism)?'checked':null;?>> 旗帜（flag）</label>
        <label class="layui-form-checkbox" style="margin-left: 12px;"><input type="checkbox" name="green_label_terrorism[]" value="location" <?php echo in_array('location',$green_label_terrorism)?'checked':null;?>> 地标（location）</label>
        <label class="layui-form-checkbox" style="margin-left: 12px;"><input type="checkbox" name="green_label_terrorism[]" value="drug" <?php echo in_array('drug',$green_label_terrorism)?'checked':null;?>> 涉毒（drug）</label>
        <label class="layui-form-checkbox" style="margin-left: 12px;"><input type="checkbox" name="green_label_terrorism[]" value="gamble" <?php echo in_array('gamble',$green_label_terrorism)?'checked':null;?>> 赌博（gamble）</label>
    </div>
</div>
                    

                    

                    <div class="layui-form-item text-right">
                        <button type="reset" id="formreset1" class="layui-btn layui-btn-primary">&emsp;重置&emsp;</button>
                        <button class="layui-btn" type="button" lay-submit lay-filter="notice-btn">&emsp;提交&emsp;</button>
                    </div>

                </form>
            </div>
        </div>
    </div>
    <?php } ?>


    <!--腾讯云检测-->
    <?php if ($conf['green_check'] == 2 ) {?>
    <div class="layui-card">
        <div id="divLoading">
            <div class="layui-card-header">腾讯云检测设置</div>
            <div class="layui-card-body">
                <form method="post" class="layui-form" id="formAdvForm" lay-filter="formAdvForm" role="form">
                    

                    
                        <div class="layui-form-item">
                            <label class="layui-form-label">腾讯云SecretId</label>
                            <div class="layui-input-block">
                                <input type="text" name="qcloud_green_id" class="layui-input" value="<?php echo $conf['qcloud_green_id'];?>" placeholder="">
                            </div>
                        </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">腾讯云SecretKey</label>
                        <div class="layui-input-block">
                            <input type="text" name="qcloud_green_key" class="layui-input" value="<?php echo $conf['qcloud_green_key'];?>">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">图片检测接入区域</label>
                        <div class="layui-input-block">
                            <input type="text" name="green_check_region" class="layui-input" value="<?php echo $conf['green_check_region'];?>">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">图片检测访问网址</label>
                        <div class="layui-input-block">
                            <input type="text" name="apiurl" class="layui-input" value="<?php echo $conf['apiurl'];?>">
                        </div>
                    </div>



                    <div class="layui-form-item text-right">
                        <button type="reset" id="formreset1" class="layui-btn layui-btn-primary">&emsp;重置&emsp;</button>
                        <button class="layui-btn" type="button" lay-submit lay-filter="notice-btn">&emsp;提交&emsp;</button>
                    </div>
                </form>
            </div>

            <div class="panel-footer">
                <span class="glyphicon glyphicon-info-sign"></span>
                阿里云内容安全接口：<a href="https://yundun.console.aliyun.com/?p=cts#/api/statistics" target="_blank" rel="noreferrer">点此进入</a>｜<a href="https://usercenter.console.aliyun.com/#/manage/ak" target="_blank" rel="noreferrer">获取密钥</a><br/>
                腾讯云内容安全接口：<a href="https://cloud.tencent.com/product/ims" target="_blank" rel="noreferrer">点此进入</a>｜<a href="https://console.cloud.tencent.com/cam/capi" target="_blank" rel="noreferrer">获取密钥</a><br/>
                屏蔽类型选不选都可以，会同时根据返回的建议结果进行屏蔽
            </div>
            
        </div>
    </div>
    <?php } ?>

</div>

<?php }elseif($mod=="kuaijie"){ ?>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-header">用户登录设置</div>
        <div class="layui-card-body">
            <form method="post" class="layui-form" id="formAdvForm" lay-filter="formAdvForm" role="form">

           <div class="layui-form-item">
                    <label class="layui-form-label">用户登录开关</label>
                    <div class="layui-input-block">
                        <select name="userlogin" class="layui-input" default="<?=$conf['userlogin']?>">
                            <option <?php echo $conf['userlogin'] == 0 ? 'selected ' : '' ?>value="0">关闭登录</option>
                            <option <?php echo $conf['userlogin'] == 1 ? 'selected ' : '' ?>value="1">彩虹聚合登录</option>
                        </select>
                    </div>
                </div>

                 <div class="layui-form-item">
                    <label class="layui-form-label">用户注册</label>
                    <div class="layui-input-block">
                        <select name="login_zc" class="layui-input" default="<?=$conf['login_zc']?>">
                            <option <?php echo $conf['login_zc'] == 0 ? 'selected ' : '' ?>value="0">关闭</option>
                            <option <?php echo $conf['login_zc'] == 1 ? 'selected ' : '' ?>value="1">开启</option>
                        </select>
                        <div class="form-tips">关闭注册后，之前未登录过的账号将无法注册登录！</div>
                    </div>
                    
                </div>
           
                <div class="layui-form-item">
                    <label class="layui-form-label">QQ登录</label>
                    <div class="layui-input-block">
                        <select name="login_qq" class="layui-input" default="<?=$conf['login_qq']?>">
                            <option <?php echo $conf['login_qq'] == 0 ? 'selected ' : '' ?>value="0">关闭</option>
                            <option <?php echo $conf['login_qq'] == 1 ? 'selected ' : '' ?>value="1">彩虹聚合登录</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">微信登录</label>
                    <div class="layui-input-block">
                        <select name="login_wx" class="layui-input" default="<?=$conf['login_wx']?>" lay-filter="login_wx">
                            <option <?php echo $conf['login_wx'] == 0 ? 'selected ' : '' ?>value="0">关闭</option>
                            <option <?php echo $conf['login_wx'] == 1 ? 'selected ' : '' ?>value="1">彩虹聚合登录</option>
                        </select>
                    </div>
                </div>

                

                <div class="layui-form-item text-right">
                    <button type="reset" id="formreset1" class="layui-btn layui-btn-primary">&emsp;重置&emsp;</button>
                    <button class="layui-btn" type="button" lay-submit lay-filter="notice-btn">&emsp;提交&emsp;</button>
                </div>
            </form>
        </div>
    </div>

    <?php if($conf['login_qq']==1 || $conf['login_alipay']==1 || $conf['login_wx']==1){?>
    <div class="layui-card">
        <div class="layui-card-header">彩虹聚合登录接口配置</div>
        <div class="layui-card-body">
            <form method="post" class="layui-form" id="formAdvForm" lay-filter="formAdvForm" role="form">

                <div class="layui-form-item">
                    <label class="layui-form-label">登录API接口</label>
                    <div class="layui-input-block">
                        <input type="text" name="login_apiurl" class="layui-input" placeholder="彩虹聚合登录api接口" value="<?=$conf['login_apiurl']?>">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">APPID</label>
                    <div class="layui-input-block">
                        <input type="text" name="login_appid" class="layui-input" placeholder="登录APPID" value="<?=$conf['login_appid']?>">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">APPKEY</label>
                    <div class="layui-input-block">
                        <input type="text" name="login_appkey" class="layui-input" placeholder="登录APPKEY" value="<?=$conf['login_appkey']?>">
                    </div>
                </div>

                <div class="layui-form-item text-right">
                    <button type="reset" id="formreset1" class="layui-btn layui-btn-primary">&emsp;重置&emsp;</button>
                    <button class="layui-btn" type="button" lay-submit lay-filter="notice-btn">&emsp;提交&emsp;</button>
                </div>
            </form>
        </div>
    </div>
    <?php } ?>
</div>

<?php }elseif($mod=="api"){ ?>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-header">API接口设置</div>
        <div class="layui-card-body">
            <form method="post" class="layui-form" id="formAdvForm" lay-filter="formAdvForm" role="form">

           <div class="layui-form-item">
                    <label class="layui-form-label">API开关</label>
                    <div class="layui-input-block">
                        <select name="api_open" class="layui-input" default="<?=$conf['api_open']?>">
                            <option <?php echo $conf['api_open'] == 0 ? 'selected ' : '' ?>value="0">关闭</option>
                            <option <?php echo $conf['api_open'] == 1 ? 'selected ' : '' ?>value="1">开启</option>
                        </select>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">来源域名白名单</label>
                    <div class="layui-input-block">
                        <input type="text" name="api_referer" class="layui-input" placeholder="多个域名用|隔开" value="<?=$conf['api_referer']?>">
                    </div>
                     <font color="green">多个域名用|隔开，不填写则不限制来源域名</font>
                </div>

                <div class="layui-form-item text-right">
                    <button type="reset" id="formreset1" class="layui-btn layui-btn-primary">&emsp;重置&emsp;</button>
                    <button class="layui-btn" type="button" lay-submit lay-filter="notice-btn">&emsp;提交&emsp;</button>
                </div>

                    <div class="container">
                            <div class="api-doc">
                                <div class="layui-card">
                                    <div class="layui-card-header">
                                        <h3>上传API文档</h3>
                                    </div>
                                    <div class="layui-card-body">
                                        <div class="api-info">
                                            <p><strong>API接口地址：</strong><span class="code"><?php echo $siteurl?>api.php</span></p>
                                            <p>当前API仅支持JSON返回方式，支持Web跨域调用，也支持程序中直接调用。</p>
                                            <p><strong>请求方式：</strong>POST multipart/form-data</p>
                                        </div>

                                        <div class="section-title">请求参数说明</div>
                                        <div class="param-table">
                                            <table class="layui-table">
                                                <thead>
                                                    <tr>
                                                        <th>字段名</th>
                                                        <th>变量名</th>
                                                        <th>是否必填</th>
                                                        <th>示例值</th>
                                                        <th>描述</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td>文件</td>
                                                        <td>file</td>
                                                        <td><span class="layui-badge layui-bg-red">是</span></td>
                                                        <td></td>
                                                        <td>multipart格式文件</td>
                                                    </tr>
                                                    <tr>
                                                        <td>是否首页显示</td>
                                                        <td>show</td>
                                                        <td><span class="layui-badge">否</span></td>
                                                        <td>1</td>
                                                        <td>默认为是</td>
                                                    </tr>
                                                    <tr>
                                                        <td>是否设置密码</td>
                                                        <td>ispwd</td>
                                                        <td><span class="layui-badge">否</span></td>
                                                        <td>0</td>
                                                        <td>默认为否</td>
                                                    </tr>
                                                    <tr>
                                                        <td>下载密码</td>
                                                        <td>pwd</td>
                                                        <td><span class="layui-badge">否</span></td>
                                                        <td>123456</td>
                                                        <td>默认留空</td>
                                                    </tr>
                                                    <tr>
                                                        <td>返回格式</td>
                                                        <td>format</td>
                                                        <td><span class="layui-badge">否</span></td>
                                                        <td>json</td>
                                                        <td>有json、jsonp、form三种选择，默认为json</td>
                                                    </tr>
                                                    <tr>
                                                        <td>跳转页面url</td>
                                                        <td>backurl</td>
                                                        <td><span class="layui-badge">否</span></td>
                                                        <td>http://...</td>
                                                        <td>上传成功后的跳转地址，只在form格式有效</td>
                                                    </tr>
                                                    <tr>
                                                        <td>callback</td>
                                                        <td>callback</td>
                                                        <td><span class="layui-badge">否</span></td>
                                                        <td>callback</td>
                                                        <td>只在jsonp格式有效</td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>

                                        <div class="section-title">返回参数说明</div>
                                        <div class="param-table">
                                            <table class="layui-table">
                                                <thead>
                                                    <tr>
                                                        <th>字段名</th>
                                                        <th>变量名</th>
                                                        <th>类型</th>
                                                        <th>示例值</th>
                                                        <th>描述</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td>上传状态</td>
                                                        <td>code</td>
                                                        <td><span class="layui-badge layui-bg-orange">Int</span></td>
                                                        <td>0</td>
                                                        <td>0为成功，其他为失败</td>
                                                    </tr>
                                                    <tr>
                                                        <td>提示信息</td>
                                                        <td>msg</td>
                                                        <td><span class="layui-badge layui-bg-blue">String</span></td>
                                                        <td>上传成功！</td>
                                                        <td>如果上传失败会有错误提示</td>
                                                    </tr>
                                                    <tr>
                                                        <td>文件MD5</td>
                                                        <td>hash</td>
                                                        <td><span class="layui-badge layui-bg-blue">String</span></td>
                                                        <td>f1e807cb0d6ba52d71bdb02864e6bda8</td>
                                                        <td></td>
                                                    </tr>
                                                    <tr>
                                                        <td>文件名称</td>
                                                        <td>name</td>
                                                        <td><span class="layui-badge layui-bg-blue">String</span></td>
                                                        <td>exapmle1.jpg</td>
                                                        <td></td>
                                                    </tr>
                                                    <tr>
                                                        <td>文件大小</td>
                                                        <td>size</td>
                                                        <td><span class="layui-badge layui-bg-orange">Int</span></td>
                                                        <td>58937</td>
                                                        <td>单位：字节</td>
                                                    </tr>
                                                    <tr>
                                                        <td>文件格式</td>
                                                        <td>type</td>
                                                        <td><span class="layui-badge layui-bg-blue">String</span></td>
                                                        <td>jpg</td>
                                                        <td></td>
                                                    </tr>
                                                    <tr>
                                                        <td>下载地址</td>
                                                        <td>downurl</td>
                                                        <td><span class="layui-badge layui-bg-blue">String</span></td>
                                                        <td>http://.....</td>
                                                        <td></td>
                                                    </tr>
                                                    <tr>
                                                        <td>预览地址</td>
                                                        <td>viewurl</td>
                                                        <td><span class="layui-badge layui-bg-blue">String</span></td>
                                                        <td>http://.....</td>
                                                        <td>只有图片、音乐、视频文件才有</td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>

                                        <div class="note">
                                            <i class="layui-icon layui-icon-tips"></i> 
                                            <strong>注意事项：</strong> 
                                            请确保使用正确的请求方式和参数格式，上传文件时请使用multipart/form-data编码。
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

            </form>
        </div>
    </div>
</div>

<?php } include 'foot.php';?>

<script type="text/javascript">
    layui.use(['layer', 'form', 'element', 'jquery', 'tagsInput', 'admin', 'laydate', 'notice', 'upload'], function () {
        var form = layui.form;
        var $ = layui.jquery;
        var layer = layui.layer;
        var tagsInput = layui.tagsInput;
        var laydate = layui.laydate;
        var admin = layui.admin;
        var notice = layui.notice;
        var upload = layui.upload;
        
        var items = $("select[default]");
            for (i = 0; i < items.length; i++) {
            $(items[i]).val($(items[i]).attr("default")||0);
        }
        
        // 上传logo文件
        var uploadInst = upload.render({
            elem: '.upload-logo', //绑定元素
            url: 'ajax.php?act=uploadlogo', //上传接口
            accept: 'images', // 只允许上传图片
            acceptMime: 'image/*', // 只允许上传图片
            size: 5120, //单位kb
            done: function(res){
                //上传完毕回调
                if(res.code === 0){
                    layer.msg(res.msg, { icon: 6 });
                    $("#logourl").val(res.url);
                }else{
                    layer.msg(res.msg, {
                        icon: 5
                    });
                }
            },
            error: function(){
                //请求异常回调
                layer.msg("请求上传接口异常！", {
                    icon: 5
                });
            }
        });
        
        var uploadIcoInst = upload.render({
          elem: '#upload-ico',
          url: 'ajax.php?act=uploadico',
          accept: 'images',
          acceptMime: 'image/x-icon',
          exts: 'ico',
          size: 5120,
          done: function(res){
            if(res.code === 0){
              layer.msg(res.msg);
              $("#icourl").val(res.url); // 将上传成功的图片URL写入到表单输入框内
            }else{
              layer.msg(res.msg);
            }
          },
          error: function(){
            layer.msg("请求上传接口异常！");
          }
        });
        
        // 绑定查看图片按钮的点击事件
        $('button[title="查看图片"]').on('click', function() {
            var imgUrl = $(this).prev().val();
            // 如果输入框中有图片链接，则打开新窗口显示图片
            if (imgUrl) {
              layer.open({
                type: 1,
                title: '当前图片',
                closeBtn: 1,
                area: ['90%', '90%'],
                skin: 'layui-layer-nobg', //没有背景色
                shadeClose: true,
                content: '<img src="' + imgUrl + '" alt="" width="100%" height="100%">'
              });
            } else {
                layer.msg('请先上传图片');
            }
        });
        
    	// 输入框样式
        $('#demoTagsInput1').tagsInput();     
        //重置表单
        $('#formreset').click(function() {
            document.getElementById("formAdvForm").reset();
            notice.destroy();
            layer.msg('重置表单成功！', {
                animateInside: true,
                icon: 1
            });
        });
        //验证配置
        $('#mailtest').click(function () {
        admin.showLoading('#divLoading', 2, '.8');
            $.ajax({
                type: "GET",
                url: "ajax.php?act=mailtest",
                dataType: "json",
                success: function(data) {
                admin.removeLoading('#divLoading', true, true);
                    notice.destroy();
                    if (data.code == 0) {
                        notice.success({
                            title: '消息通知',
                            message: data.msg,
                            position:'topCenter',
                            audio:''
                        });
                    } else {
                        notice.error({
                            title: '消息通知',
                            message: data.msg,
                            position:'topCenter',
                            audio:''
                        });
                    }
                }
            });
        }); 
        
        // 图片检测显隐
        form.on('select(green_check_porn)', function(data){
            if (data.value == '1') {
                $("#green_check_porn_").show(500);
            } else {
                $("#green_check_porn_").hide(500);
            }
        });
        form.on('select(green_check_terrorism)', function(data){
            if (data.value == '1') {
                $("#green_check_terrorism_").show(500);
            } else {
                $("#green_check_terrorism_").hide(500);
            }
        });

        //通用
        form.on('submit(notice-btn)', function (data) { 
            notice.msg('正在修改配置中..', {icon: 4, close: true});
            $.ajax({
                type: "POST",
                url: "ajax.php?act=set",
                data: data.field,
                dataType: "json",
                success: function(data) {
                    notice.destroy();
                    if (data.code == 0) {
                        notice.success({
                            title: '消息通知',
                            message: '设置保存成功！',
                            position:'topCenter',
                            audio:''
                        });
                        setTimeout(function(){
                            location.reload();
                        }, 2500);
                    } else {
                        notice.error({
                            title: '消息通知',
                            message: data.msg,
                            position:'topCenter',
                            audio:''
                        });
                    }
                }
            });
            return false;
        });

        window.changeTemplate = function(template) { //更换首页模板
            var ii = layer.msg('正在更换首页模板中,请稍后...', {
                icon: 16,
                time: 10 * 1000
            });
            $.ajax({
                type: 'POST',
                url: 'ajax.php?act=set',
                data: {
                    template: template
                },
                dataType: 'json',
                success: function(data) {
                    layer.close(ii);
                    if (data.code == 0) {
                        notice.success({
                            title: '消息通知',
                            message: '首页模板更换成功！',
                            position: 'topCenter',
                            audio: ''
                        });
                        setTimeout(function() {
                            location.reload(); // 刷新页面
                        }, 1500); //1.5秒后刷新
                    } else {
                        notice.error({
                            title: '消息通知',
                            message: data.msg,
                            position: 'topCenter',
                            audio: ''
                        });
                    }
                },
                error: function(data) {
                    layer.msg('服务器错误', {
                        icon: 5
                    });
                    return false;
                }
            });
            return false;
        }
        
        
        form.on('submit(random)', function(data) {
            $.ajax({
                type: 'POST',
                url: 'ajax.php?act=random&len=32',
                dataType: 'json',
                success: function(data) {
                    $("input[name=cronkey]").val(data.content)
                },
                error: function(data) {
                    layer.msg('服务器错误');
                    return false;
                }
            });
            return false;
        });
        // 测试连通性
        form.on('submit(cloud_lt)', function(data){
            notice.msg('正在测试连通性..', {icon: 4, close: true});
            $.ajax({
                type: "POST",
                url: "ajax.php?act=cloud_lt",
                data: data.field,
                dataType: "json",
                success: function(data) {
                    notice.destroy();
                    if (data.code == 0) {
                        notice.success({
                            title: '消息通知',
                            message: data.msg,
                            position:'topCenter',
                            audio:''
                        });
                    } else {
                        notice.error({
                            title: '消息通知',
                            message: data.msg,
                            position:'topCenter',
                            audio:''
                        });
                    }
                }
            });
            return false;
        });
        // 查询余额
        form.on('submit(cloud_yue)', function(data){
            notice.msg('正在查询余额..', {icon: 4, close: true});
            $.ajax({
                type: "POST",
                url: "ajax.php?act=cloud_yue",
                data: data.field,
                dataType: "json",
                success: function(data) {
                    notice.destroy();
                    if (data.code == 0) {
                        notice.success({
                            title: '消息通知',
                            message: data.msg,
                            position:'topCenter',
                            audio:''
                        });
                    } else {
                        notice.error({
                            title: '消息通知',
                            message: data.msg,
                            position:'topCenter',
                            audio:''
                        });
                    }
                }
            });
            return false;
        });
       
    });
</script>